<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/system/common/head.jsp"%>
<script type="text/javascript" src="asserts/plugins/easyui/plugins/jquery-easyui-datagridview/datagrid-detailview.js"></script>
<body>

<table style="width: 100%; height: 100%">
    <tr>
        <td style="width: 60%; vertical-align: top;">
<form id="form1" name="form1" method="post" action="">
    <div id="qp" class="easyui-panel" collapsible="true" style="padding:10px;">
        分组:
        <select id="recordType" name="recordType"  class="easyui-combobox" style="width:200px;" >
            <option value="">全部</option>
            <c:forEach items="${typeList}" var="typeItem" >
                <option value="${typeItem.value }">${typeItem.name }</option>
            </c:forEach>
        </select>

        <span style="margin-left:20px;">设备用户名:</span>
        <input class="easyui-validatebox myinput" type="text" name="userName"  maxlength="10" id="userName" style="width: 100px"></input>

        <a  class="easyui-linkbutton myLink" iconCls="icon-ok" style="margin-left:20px;"
            onclick="queryDataGrid()">查询 </a>

        <a  class="easyui-linkbutton myLink" iconCls="icon-undo" style="margin-left:10px;"
            onclick="restDataGrid()">重置 </a>
    </div>
    <table id="datagrid"></table>
</form>


        </td>

    </tr>
</table>

</body>
<script type="text/javascript" charset="UTF-8">


    function queryDataGrid(){
        var valid = $('#form1').form('validate');
        if (valid) {
            var param = $('#form1').serializeJson(true);
            $('#datagrid').datagrid('load', param);
        }
    }

    function restDataGrid(){
        $('#form1').form("reset");
        queryDataGrid();
    }

    var dataGrid = commonDataGrid({
        url:'community/alarm/query',
        fit: false, //datagrid自适应宽高
        loadFilter : function(data) {
            if (data.status == 0) {
                var total = 0;
                var rows = "";// 当为[]会出现空的两行
                var push = { "total" : total,"rows" : rows};
                $.messager.alert('提示:', '远程服务调用失败', 'error');
                return push;
            } else {
                return data;
            }

        },
        columns:[[
            {field:'devName',title:'设备名称',align:'center'},
            {field:'devImei',title:'设备imei',align:'center'},
            {field:'devUserName',title:'设备用户',align:'center'},
            {field:'sourceName',title:'报警源',align:'center'},
            {field:'sourceUserName',title:'所属用户',align:'center'},
            {field:'triggerName',title:'报警类型',align:'center'},
            {field:'opTime',title:'报警时间 ',align:'center'},
        ]],
        title:'报警记录',
        pagination:true,
       /* view: detailview,*/
       /* detailFormatter: function(rowIndex, rowData){
            return '<table class="detailGrid"></table>';
        },*/
     /*   onExpandRow: function(index,row){
            var detailGrid = $(this).datagrid('getRowDetail',index).find('table.detailGrid');//找到该父类Formatter的子类表格
            detailGrid.datagrid({
                data: row.taskList,
                fitColumns:true,
                singleSelect:true,
                rownumbers:false,
                height:'auto',
                columns:[[
                    {field:'devName',title:'设备名称'},
                    {field:'devUserName',title:'设备用户'},
                    {field:'triggerName',title:'报警源'},
                    {field:'triggerType',title:'报警类型'},
                    {field:'opTime',title:'报警时间'},
                ]],
                onResize:function(){
                    dataGrid.datagrid('fixDetailRowHeight',index);
                },
                onLoadSuccess:function(){
                    dataGrid.datagrid('fixDetailRowHeight',index);
                }
            });
            dataGrid.datagrid('fixDetailRowHeight',index);
        }*/
    });


</script>
</html>